import React, { Fragment } from 'react';
import { connect } from 'dva';
import { Icon } from 'antd';
import styles from './UserLayout.less';
// eslint-disable-next-line import/extensions
import SelectLang from '@/components/SelectLang';
// eslint-disable-next-line import/extensions
import GlobalFooter from '@/components/GlobalFooter';

const copyright = (
  <Fragment>
    Copyright <Icon type="copyright" /> 2021 深圳恒鼎智能装备有限公司 V1.0
  </Fragment>
);

@connect(({ hd }) => ({ hd }))
class UserLayout extends React.PureComponent {
  componentDidMount() {
    const { dispatch } = this.props;
    window.eel.createWebSocketConnection(dispatch);
  }

  render() {
    const { children } = this.props;
    return (
      // @TODO <DocumentTitle title={this.getPageTitle()}>
      <div className={styles.container}>
        <div className={styles.lang}>
          <SelectLang />
        </div>
        <div className={styles.content}>
          <div className={styles.top}>
            <div className={styles.header}>
              <h1>请输入用户名和密码</h1>
            </div>
          </div>
          {children}
        </div>
        <GlobalFooter copyright={copyright} />
      </div>
    );
  }
}

export default UserLayout;
